package com.easyj.admin.db.model;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.easyj.base.cache.SysCacheUtil;
import com.easyj.base.enums.SimpleApplyStatusEnum;

/**
 *   @title 荣誉
 *   @remark 
 *   @table s_award
 *   @primaryKey id
 *   @enablePage true
 */
public class Award implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     *   @title 
     *   @remark 
     *   @column id
     *   @dataType BIGINT UNSIGNED
     *   @length 20
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long id;

    /**
     *   @title 荣誉名称
     *   @remark 
     *   @column name
     *   @dataType VARCHAR
     *   @length 250
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    @NotBlank
    private String name;
    

    /**
     *   @title 申请标题
     *   @remark 
     *   @column apply_name
     *   @dataType VARCHAR
     *   @length 250
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String applyName;

    /**
     *   @title 获奖时间
     *   @remark 
     *   @column got_time
     *   @dataType DATETIME
     *   @length 19
     *   @scale 0
     *   @nullable false
     *   @jdbcType TIMESTAMP
     */
     @NotNull
    private Date gotTime;

    /**
     *   @title 荣誉类型
     *   @remark 
     *   @column type
     *   @dataType VARCHAR
     *   @length 250
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
     @NotNull
    private String type;

    /**
     *   @title 获得人/学生
     *   @remark 
     *   @column winner
     *   @dataType VARCHAR
     *   @length 500
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    @NotNull
    private String winner;

    /**
     *   @title 颁发部门
     *   @remark 
     *   @column giving_dept
     *   @dataType VARCHAR
     *   @length 250
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    private String givingDept;

    /**
     *   @title 获得人所属部门、班级
     *   @remark 
     *   @column win_dept
     *   @dataType VARCHAR
     *   @length 300
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String winDept;

    /**
     *   @title 荣誉级别
     *   @remark 
     *   @column reward_level
     *   @dataType VARCHAR
     *   @length 50
     *   @scale 0
     *   @nullable false
     *   @jdbcType VARCHAR
     */
    @NotNull
    private String rewardLevel;

    /**
     *   @title 描述说明
     *   @remark 
     *   @column content
     *   @dataType VARCHAR
     *   @length 500
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String content;

    /**
     *   @title 附件
     *   @remark 
     *   @column append_files
     *   @dataType JSON
     *   @length 0
     *   @scale 0
     *   @nullable true
     *   @jdbcType CHAR
     */
    private String appendFiles;

    /**
     *   @title 申请人
     *   @remark 
     *   @column applicant_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long applicantId;

    /**
     *   @title 申请人所属部门
     *   @remark 冗余
     *   @column dept_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable false
     *   @jdbcType BIGINT
     */
    private Long deptId;

    /**
     *   @title 申请日期
     *   @remark 
     *   @column apply_time
     *   @dataType DATETIME
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType TIMESTAMP
     */
    private Date applyTime;
    
    

    /**
     *   @title 审批人
     *   @remark 
     *   @column approve_id
     *   @dataType BIGINT
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType BIGINT
     */
    private Long approveId;

    /**
     *   @title 审批日期
     *   @remark 
     *   @column approve_time
     *   @dataType DATETIME
     *   @length 19
     *   @scale 0
     *   @nullable true
     *   @jdbcType TIMESTAMP
     */
    private Date approveTime;

    /**
     *   @title 审批意见
     *   @remark 
     *   @column approve_comment
     *   @dataType VARCHAR
     *   @length 500
     *   @scale 0
     *   @nullable true
     *   @jdbcType VARCHAR
     */
    private String approveComment;

    /**
     *   @title 状态
     *   @remark 
     *   @column status
     *   @dataType INT
     *   @length 10
     *   @scale 0
     *   @nullable false
     *   @jdbcType INTEGER
     */
    private Integer status;
    
    /**
     * 
     * @return 荣誉类型
     */
    public String getTypeName() {
      return SysCacheUtil.getDirtionaryItemName("AWARDTYPE", type);
    }
    
    /**
     * 
     * @return 荣誉级别
     */
    public String getPublishLevelName() {
      return SysCacheUtil.getDirtionaryItemName("AWARDLEVEL", rewardLevel);
    }
    
    /**
     * 
     * @return 状态
     */
    public String getStatusName() {
    	return SimpleApplyStatusEnum.getText(status);
    }
    
    /**
     * 
     * @return 申请人
     */
    public String getApplicantName(){
    	return SysCacheUtil.getOperatorName(applicantId);
    }
    
    /**
     * 
     * @return 所属部门
     */
    public String getDeptName(){
    	return SysCacheUtil.getDepartmentName(deptId);
    }
    
    /**
     * 
     * @return 审批人
     */
    public String getApproveName(){
    	return SysCacheUtil.getOperatorName(approveId);
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getGotTime() {
        return gotTime;
    }

    public void setGotTime(Date gotTime) {
        this.gotTime = gotTime;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getWinner() {
        return winner;
    }

    public void setWinner(String winner) {
        this.winner = winner;
    }

    public String getGivingDept() {
        return givingDept;
    }

    public void setGivingDept(String givingDept) {
        this.givingDept = givingDept;
    }

    public String getWinDept() {
        return winDept;
    }

    public void setWinDept(String winDept) {
        this.winDept = winDept;
    }

    public String getRewardLevel() {
        return rewardLevel;
    }

    public void setRewardLevel(String rewardLevel) {
        this.rewardLevel = rewardLevel;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAppendFiles() {
        return appendFiles;
    }

    public void setAppendFiles(String appendFiles) {
        this.appendFiles = appendFiles;
    }

    public Long getApplicantId() {
        return applicantId;
    }

    public void setApplicantId(Long applicantId) {
        this.applicantId = applicantId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Date getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Date applyTime) {
        this.applyTime = applyTime;
    }

    public Long getApproveId() {
        return approveId;
    }

    public void setApproveId(Long approveId) {
        this.approveId = approveId;
    }

    public Date getApproveTime() {
        return approveTime;
    }

    public void setApproveTime(Date approveTime) {
        this.approveTime = approveTime;
    }

    public String getApproveComment() {
        return approveComment;
    }

    public void setApproveComment(String approveComment) {
        this.approveComment = approveComment;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getApplyName() {
		return applyName;
	}

	public void setApplyName(String applyName) {
		this.applyName = applyName;
	}

	@Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Award other = (Award) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", gotTime=").append(gotTime);
        sb.append(", type=").append(type);
        sb.append(", winner=").append(winner);
        sb.append(", givingDept=").append(givingDept);
        sb.append(", winDept=").append(winDept);
        sb.append(", rewardLevel=").append(rewardLevel);
        sb.append(", content=").append(content);
        sb.append(", appendFiles=").append(appendFiles);
        sb.append(", applicantId=").append(applicantId);
        sb.append(", deptId=").append(deptId);
        sb.append(", applyTime=").append(applyTime);
        sb.append(", approveId=").append(approveId);
        sb.append(", approveTime=").append(approveTime);
        sb.append(", approveComment=").append(approveComment);
        sb.append(", status=").append(status);
        sb.append("]");
        return sb.toString();
    }
}